1. Field of the Invention
The present invention relates to a control device that executes a control program including a floating point operation command for controlling a machine and a method of converting a floating point parameter in the control program.
2. Description of the Related Art
Data of types handled in a control program of a control device for controlling a machine such as a programmable controller includes data in bit format, in byte format, in word format and in similar format. The data of each type is stored in an internal memory. Moreover, there is also a control device, for controlling a machine, which handles the floating point data defined by IEEE754 in operation commands and the like of the control program.
The control device for controlling a machine outputs various data as parameter data in a predetermined format to an external device such as a personal computer or an external storage medium, for a backup. The control device for controlling a machine can capture the parameter data that is edited in the external device as needed. Moreover, as to data and the like stored in a non-volatile memory corresponding to the internal memory, there is sometimes a case where initial parameters are created on the external device in advance and inputted to the control device for controlling a machine along with the control program.
Japanese Patent Laid-Open No. 59-123009 discloses a technology in which a real number value stored as floating point data in a memory of a processing device is converted into a decimal format or another format to be outputted to an external device.
As disclosed in Japanese Patent Laid-Open No. 59-123009, if the floating point data stored in the memory of the processing device is converted into a numeric string in decimal format to be outputted at a time of outputting the floating point data to an external storage medium for the purpose of backup or the like, the numeric string contains a rounding error arising in the conversion.
Moreover, Japanese Patent Laid-Open No. 59-123009 discloses a technology in which, when the numeric string in decimal format is read into the processing device from the external storage medium, the numeric string in decimal format is inversely converted into the floating point data. However, with this technique, the numeric string in decimal format is converted into the floating point data containing the error arising in the conversion into the decimal number. The original floating point data cannot be restored.
Furthermore, Japanese Patent Laid-Open No. 59-123009 also discloses a technology in which the floating point data stored in the memory of the processing device is compared with the floating point data that is obtained by inversely converting the numeric string in decimal format outputted to the external storage medium thereinto. Since such a comparison unit attempts comparison within a range including the rounding error, the comparison unit is not usable as one as to whether both pieces of the floating point data are exactly the same value.
As another output format, there is also known a method in which the floating point data is converted into a numeric string in hexadecimal format to be outputted to the external device or the like. This method does not cause the possible contamination of an error in the data on the occasion of data input. Nevertheless, when the content of the numeric string in hexadecimal format is confirmed on the part of the external device, the content cannot be readily recognized because the data is expressed as the numeric string in hexadecimal format.
As still another output format, there is further known a method in which the floating point data is outputted to the external device or the like as it is. In such a case, the outputted floating point data is displayed and/or changed as a numeric string in decimal format on the external device. For the purpose, it is necessary for the external device to have a unit that converts the floating point data into the numeric string in decimal format and/or a unit that inversely converts the numeric string in decimal format into the floating point data.
Such conversion units, however, require that the conversion algorithm implemented in the control device be exactly identical to that implemented in the external device. Otherwise, the conversion operation in the control device possibly differ from that in the external device. It is difficult for the control device to completely match the external device in a CPU including a co-processor and an OS environment. Hence, it is exceedingly difficult to provide such a conversion unit for which the conversion algorithm implemented in the control device should be exactly identical to that implemented in the external device.